<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>还原之前的错误处理函数</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.restore-error-handler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">restore_error_handler</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.1, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">restore_error_handler</span> &mdash; <span class="dc-title">还原之前的错误处理函数</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.restore-error-handler-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>restore_error_handler</strong></span>
    ( <span class="methodparam">void</span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   
   在使用 <span class="function"><a href="set_error_handler.html" class="function">set_error_handler()</a></span> 改变错误处理函数之后，此函数可以
   用于还原之前的错误处理程序(可以是内置的或者也可以是用户所定义的函数)。
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.restore-error-handler-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   该函数总是返回 <strong><code>TRUE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.restore-error-handler-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-462">
    <p><strong>Example #1 <span class="function"><strong>restore_error_handler()</strong></span> 范例</strong></p>
    <div class="example-contents"><p>
     如果是 <span class="function"><a href="unserialize.html" class="function">unserialize()</a></span> 导致了一个错误，接下来
     会恢复原来的错误处理函数。
    </p></div>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">unserialize_handler</span><span style="color: #007700">(</span><span style="color: #0000BB">$errno</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$errstr</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Invalid&nbsp;serialized&nbsp;value.\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$serialized&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">set_error_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">'unserialize_handler'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$original&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">unserialize</span><span style="color: #007700">(</span><span style="color: #0000BB">$serialized</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">restore_error_handler</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Invalid serialized value.
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.restore-error-handler-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="error_reporting.html" class="function" rel="rdfs-seeAlso">error_reporting()</a> - 设置应该报告何种 PHP 错误</span></li>
    <li class="member"><span class="function"><a href="set_error_handler.html" class="function" rel="rdfs-seeAlso">set_error_handler()</a> - 设置用户自定义的错误处理函数</span></li>
    <li class="member"><span class="function"><a href="restore_exception_handler.html" class="function" rel="rdfs-seeAlso">restore_exception_handler()</a> - 恢复之前定义过的异常处理函数。</span></li>
    <li class="member"><span class="function"><a href="trigger_error.html" class="function" rel="rdfs-seeAlso">trigger_error()</a> - 产生一个用户级别的 error/warning/notice 信息</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>